import { observable, action } from "mobx"
import { uaaApp } from "@/lib";

class UdMainStore {
  @observable
  public contentLoading: boolean = false;
  @observable
  public collapse: boolean = false;

  public brandList: any[] = [];
  public initialBrandValue: string | undefined = undefined;
  /**更新加载状态*/
  @action
  public updateContentLoading = (status)=>{
    this.contentLoading = status;
  };
  /**更新菜单展开状态*/
  @action
  public updateCollapse = (status)=>{
    this.collapse = status;
  };

  /** 更新登录人品牌公司 */
  public updateBrandList = (brandList) => {
    this.brandList = brandList
  }

  public logOut = () => {
    uaaApp.signOut()
  }
}

export interface IUdMainStore {
  contentLoading: boolean
  collapse: boolean
  brandList: any[]
  initialBrandValue: string | undefined
  updateContentLoading: (status) => void
  updateCollapse: (status) => void
  logOut: () => void
  updateBrandList: (list: any[]) => void
}

const udMainStore: IUdMainStore = new UdMainStore();

export default udMainStore;